/**
 * @brief EEPROM driver header
 * @author Gilad Avidov
 */
#ifndef EEPROM_H_INCLUDED
#define EEPROM_H_INCLUDED

/*
 * @return zero on success non zero on failure
 * @block block number 0..0xF
 * @offset 0..0xFF
 * @buf buffer to read len byte into
 * @len buffer length, 1..16 , when > 1 offset must be on 16 byte boundary
 */
unsigned char eeprom_read(unsigned char block, unsigned char offset,
                            xdata unsigned char *buf, unsigned char len);

unsigned char eeprom_write(unsigned char block, unsigned char offset,
                            xdata unsigned char *buf, unsigned char len);

#define EEPROM_BLOCK_SZ (16)

// Name: eereset() // Description: Performs a software reset of the I2C EEPROM using an
// algorithm that conforms to Microchip application note AN709.
void eereset();

#endif // EEPROM_H_INCLUDED
